package biz.obake.team.touchprotector.d.d;

import android.os.SystemClock;
import c.b.a.c.a.g.e;
import d.h.b.c;
import java.util.Map;

public final class a extends biz.obake.team.touchprotector.d.b {
    public static final C0063a g = new C0063a((a) null);

    /* renamed from: d  reason: collision with root package name */
    private boolean f1555d;
    private long e;
    private final long f = 24;

    /* renamed from: biz.obake.team.touchprotector.d.d.a$a  reason: collision with other inner class name */
    public static final class C0063a {
        private C0063a() {
        }

        public /* synthetic */ C0063a(a aVar) {
            this();
        }

        public final a a() {
            if (c()) {
                return new a();
            }
            return null;
        }

        public final void b(Map<String, String> map) {
            c.c(map, "d");
            map.put("InAppUpdate.State", "Unknown");
            map.put("InAppUpdate.VersionCode", "0");
        }

        public final boolean c() {
            return true;
        }
    }

    static final class b<ResultT> implements c.b.a.c.a.g.a<c.b.a.c.a.a.a> {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ a f1556a;

        b(a aVar) {
            this.f1556a = aVar;
        }

        public final void a(e<c.b.a.c.a.a.a> eVar) {
            String str;
            this.f1556a.f(false);
            c.b(eVar, "it");
            if (eVar.g()) {
                this.f1556a.e(SystemClock.elapsedRealtime());
                if (eVar.e().n() != 2) {
                    str = "NoUpdateAvailable";
                } else {
                    biz.obake.team.touchprotector.g.c.g("InAppUpdate.VersionCode", String.valueOf(eVar.e().c()));
                    str = "UpdateAvailable";
                }
            } else {
                str = "Unknown";
            }
            biz.obake.team.touchprotector.g.c.g("InAppUpdate.State", str);
        }
    }

    public static final void d(Map<String, String> map) {
        g.b(map);
    }

    /* access modifiers changed from: protected */
    public void b(String str) {
        if (str != null) {
            int hashCode = str.hashCode();
            if (hashCode != -2066548004) {
                if (hashCode != -978418933 || !str.equals("MainActivity.State")) {
                    return;
                }
            } else if (!str.equals("TPService.State")) {
                return;
            }
            c();
        }
    }

    public final void c() {
        long j = (long) 60;
        if (!(SystemClock.elapsedRealtime() < this.e + (((this.f * j) * j) * ((long) 1000))) && !this.f1555d) {
            this.f1555d = true;
            c.b.a.c.a.a.b a2 = c.b.a.c.a.a.c.a(biz.obake.team.android.a.a());
            c.b(a2, "AppUpdateManagerFactory.…pplication.getInstance())");
            a2.a().a(new b(this));
        }
    }

    public final void e(long j) {
        this.e = j;
    }

    public final void f(boolean z) {
        this.f1555d = z;
    }

    public void start() {
        super.start();
        c();
    }
}
